﻿<UserControl x:Class="VmroleAuthor.Views.DeployResultsPageView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"            
             xmlns:vm="clr-namespace:VmroleAuthor.ViewModels"
             xmlns:vw="clr-namespace:VmroleAuthor.Views" 
             mc:Ignorable="d" 
             d:DesignWidth="500">   
    <UserControl.Resources>
        <vw:ResExtDeploymentResultDataTemplateSelector x:Key="ResExtDeploymentResultDataTemplateSelector"/>
        <vw:ResExtDeploymentResultSummaryTitleDataTemplateSelector x:Key="ResExtDeploymentResultSummaryTitleDataTemplateSelector"/>
    </UserControl.Resources>
    <Grid VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition Height="6" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="6" />
            <RowDefinition Height="*" />
            <RowDefinition Height="6" />
           
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="12"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="12"/>
        </Grid.ColumnDefinitions>

        <!-- DeploymentResultSummaryTitle -->
        <Grid Grid.Row="1" Grid.Column ="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ContentControl Grid.Row="0" Grid.Column="0"  FontSize="14" 
                    Content="{Binding DeploymentResultSummaryTitle}"
                    ContentTemplateSelector="{StaticResource ResExtDeploymentResultSummaryTitleDataTemplateSelector}"
                    HorizontalContentAlignment="Left"/>

                <Button Grid.Row="0" Grid.Column="1" Padding="0"  BorderBrush="Transparent" BorderThickness="0"  
                            Background="Transparent"  Command="{Binding CopyCommand}" 
                            Visibility="{Binding Path=CopyButtonVisibility}"
                            HorizontalAlignment="Right" HorizontalContentAlignment="Right">
                    <StackPanel HorizontalAlignment="Right">
                        <Image HorizontalAlignment="Left" Height="15" Width="15" Source="../Img/copy.ico" ToolTip="Copy messages to Clipboard"/>
                    </StackPanel>    
                </Button>          
        </Grid>

        <Border Grid.Row="3" Grid.Column="1" MinHeight="150" BorderBrush="{x:Static SystemColors.ControlDarkBrush}" BorderThickness="1" Focusable="False" Background="{x:Static SystemColors.ControlLightBrush}">
            <ScrollViewer Padding="2" Grid.Row="3" Grid.Column="1"  CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <!-- SummaryResultMessage -->
                    <ContentControl Grid.Row="0" Grid.Column ="0" FontSize="14" 
                            Content="{Binding SummaryResultMessage, Mode=OneWay}"
                            ContentTemplateSelector="{StaticResource ResExtDeploymentResultDataTemplateSelector}"/>

                    <!-- Additional Result Messages -->
                    <ItemsControl Grid.Row="1" Grid.Column ="0" BorderThickness="0" BorderBrush="Transparent" HorizontalContentAlignment="Stretch"
                          ItemsSource="{Binding AdditionalResultMessages, Mode=OneWay}" 
                          ItemTemplateSelector="{StaticResource ResExtDeploymentResultDataTemplateSelector}"
                          FontSize="14" >
                    </ItemsControl>
                </Grid>
            </ScrollViewer>
        </Border>
    </Grid>
</UserControl>
